home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / dskhrdldr.lha / TrackerRunner.s < prev   
Encoding:
Text File  |  1980-01-12  |  6.4 KB  |  352 lines

  1. ; Hard-Trackdisk Example Routine - Loads sectors 880 to 883 off drive 0
  2. ; into $c0000 with an MFM buffer at $f0000
  3. ; No interrupts/exceptions are interfered with, and code is fully multi-
  4. ; taskable (within a Hardware or System based program)
  5. ;
  6. ; This is not an interupt-driven routine. nor will it ever be, i couldn't
  7. ; be fucked to do it...  but wait n'see,  i may have something sticky up
  8. ; my sleeve.
  9. ;
  10. ; Coded by psyKo, extreme hassle and lots of time have gone into this fucker
  11. ; so i hope you spread 4 all 2 c..          (retro corp production, 19/5/93)
  12.  
  13. ; Note:  This is the new-improved meatier/chunkier version..
  14. ; New control codes for the NuTrakker Segment are:
  15.  
  16. ; d0 = 0   -   Find available drives
  17. ; d0 = 1   -   (new function)  Reset drive (d1=drive) head to track zero
  18. ; d0 = 2   -   Read Sectors
  19.  
  20. ; The Zero Head function you should use before you load a set of sectors,
  21. ; NOTE:  you dont have to do it every time you access the disk, just use
  22. ; it in initialization, and after a disk-change, or before a mass-multiple
  23. ; sector read (several Trakker Read Calls)...  i hope it worx
  24.  
  25. ; FINAL manufacture by Mr. Spillage 21-5-93
  26.  
  27.     Opt    c-
  28.     Section    "HardNuTrackDisk Example",Code_c
  29.  
  30.     IncDir    Df1:
  31.  
  32. Drive    = 1
  33.  
  34. Start    Movem.l    d0-d7/a0-a6,-(sp) 
  35.     Bsr    KillSys      
  36.     
  37.     Lea    CopperList(pc),a0 
  38.     Lea    HardWare,a6      
  39.     Move.l    a0,Cop1Lc(a6)      
  40.     Move.w    #$83c0,DMACon(a6)
  41.  
  42. *****************************************************************************
  43.  
  44.     Moveq    #0,d0    ; Setup Code
  45.     Bsr    TrackDisk+$20    ; Find Active Drives    
  46.  
  47. ; d0 - is returned with active disk drives, bits 0-3 represent drives 0-3
  48.  
  49. *****************************************************************************
  50.  
  51.     Moveq    #1,d0    ; Zero Head Code
  52.     Moveq    #Drive,d1    ; Zero drive number
  53.     Bsr    TrackDisk+$20    ; Reset Track.
  54.     
  55.     Moveq    #2,d0    ; Read Sector Code
  56.     Moveq    #Drive,d1    ; Drive Number
  57.     Move.w    #880,d2    ; Start Sector 880
  58.     Move.w    #883,d3    ; End Sector 883
  59.     Lea    $c5000,a0    ; Data Address
  60.     Lea    $f0000,a1    ; MFM Buffer pointer
  61.     Bsr    TrackDisk+$20    ; Read Sectors
  62.  
  63.     Moveq    #2,d0    ; Read Sector Code
  64.     Moveq    #Drive,d1    ; Drive Number
  65.     Move.w    #0,d2    ; Start Sector 0
  66.     Move.w    #3,d3    ; End Sector 3
  67.     Lea    $c5800,a0    ; Data Address
  68.     Lea    $f0000,a1    ; MFM Buffer pointer
  69.     Bsr    TrackDisk+$20    ; Read Sectors
  70.  
  71.     Moveq    #2,d0    ; Read Sector Code
  72.     Moveq    #Drive,d1    ; Drive Number
  73.     Move.w    #1400,d2    ; Start Sector 0
  74.     Move.w    #1403,d3    ; End Sector 3
  75.     Lea    $c5c00,a0    ; Data Address
  76.     Lea    $f0000,a1    ; MFM Buffer pointer
  77.     Bsr    TrackDisk+$20    ; Read Sectors
  78.  
  79. ; read those fucking sectors in from 880 to 883 off drive 1, fucking less
  80. ; hassle than fucking trackdisk.device, and no fucking Amiga fucking DOS
  81. ; to share your disgusting fucking memory fucking with...
  82.  
  83. *****************************************************************************
  84.  
  85. ; pleese, just dont ask why i'm fucking pissed off..
  86.  
  87.     Bsr    ReturnSys      
  88.     Movem.l    (sp)+,d0-d7/a0-a6 
  89.     Moveq    #0,d0      
  90.     Rts
  91.  
  92. KillSys    Bsr.s    SysWait    
  93.  
  94.     Move.l    $4,a6    
  95.     Lea    GFXName(pc),a1    
  96.     Moveq    #0,d0    
  97.     Jsr    -552(a6)    
  98.         
  99.     Lea    OldCop1(pc),a5
  100.     Move.l    $26(a0),$0(a5)    
  101.     Move.l    $32(a0),$4(a5)    
  102.     
  103.     Lea    HardWare,a6
  104.     Move.w    IntEnaR(a6),d0    
  105.     Move.w    DMAConR(a6),d1  
  106.     Or.w    #$8000,d0    
  107.     And.w    #$03ff,d1    
  108.     Or.w    #$8000,d1    
  109.     Move.w    d0,$8(a5)    
  110.     Move.w    d1,$a(a5)    
  111.     
  112.     Move.w    #$7fff,IntEna(a6) 
  113.     Move.w    #$7fff,DMACon(a6) 
  114.     Rts
  115.  
  116. SysWait    Move.w    #15,d7    
  117. SysWaitLoop    Move.l    #$05000,d1    
  118.     Bsr.s    WaitVBL    
  119.     Bsr.s    DoWaitVBL    
  120.     Dbf    d7,SysWaitLoop    
  121.     Rts
  122.  
  123. DoWaitVBL    Move.l    #$03000,d1    
  124. WaitVBL    Movem.l    d0-d1/a6,-(sp)    
  125.     Lea    HardWare,a6    
  126. WaitVBLLoop    Move.l    VPosR(a6),d0    
  127.     And.l    #$1ff00,d0    
  128.     Cmp.l    d1,d0    
  129.     Bne.s    WaitVBLLoop    
  130.     Movem.l    (sp)+,d0-d1/a6    
  131.     Rts        
  132.  
  133. ReturnSys    Lea    HardWare,a6    
  134.     Move.w    OldIntEna(pc),IntEna(a6)
  135.     Move.w    OldDMACon(pc),DMACon(a6)
  136.     Move.l    OldCop1(pc),Cop1lc(a6)
  137.     Move.l    OldCop2(pc),Cop2lc(a6)
  138.     Rts
  139.  
  140. GFXName    Dc.b    "graphics.library",0
  141.     Even
  142. OldCop1    Dc.l    0    
  143. OldCop2    Dc.l    0    
  144. OldIntEna    Dc.w    0    
  145. OldDmaCon    Dc.w    0    
  146. Screen    Dc.l    $c0000    
  147.  
  148. Cmv    Macro
  149.     Dc.w    \2,\1
  150.     EndM
  151.     
  152. Cwt    Macro
  153.     Dc.w    (\1*$100)+$01,$fffe
  154.     EndM    
  155.  
  156. Pal    Macro
  157.     Dc.w    $ffe1,$fffe
  158.     EndM    
  159.  
  160. EndCop    Macro
  161.     Dc.w    $ffff,$fffe
  162.     EndM    
  163.  
  164. CopperList    Cwt    $15    
  165.     Cmv    $0200,BplCon0    
  166.     Cmv    $00bb,BplCon1    
  167.     Cmv    $000a,BplCon2    
  168.     Cmv    $0034,DdfStrt    
  169.     Cmv    $00c8,DdfStop    
  170.     Cmv    $1681,DiwStrt    
  171.     Cmv    $36c1,DiwStop
  172.     Cmv    $0,BplMod1    
  173.     Cmv    $0,BplMod2    
  174.     
  175. CopperCols    Cwt    $25        
  176.     Cmv    $0,Color00
  177.     Cmv    $0,Color01
  178.     Cmv    $0,Color02
  179.     Cmv    $0,Color03
  180.     Cmv    $0,Color04
  181.     Cmv    $0,Color05
  182.     Cmv    $0,Color06
  183.     Cmv    $0,Color07
  184.     Cmv    $0,Color08
  185.     Cmv    $0,Color09
  186.     Cmv    $0,Color10
  187.     Cmv    $0,Color11
  188.     Cmv    $0,Color12
  189.     Cmv    $0,Color13
  190.     Cmv    $0,Color14
  191.     Cmv    $0,Color15
  192.     Cmv    $0,Color16
  193.     Cmv    $0,Color17
  194.     Cmv    $0,Color18
  195.     Cmv    $0,Color19
  196.     Cmv    $0,Color20
  197.     Cmv    $0,Color21
  198.     Cmv    $0,Color22
  199.     Cmv    $0,Color23
  200.     Cmv    $0,Color24
  201.     Cmv    $0,Color25
  202.     Cmv    $0,Color26
  203.     Cmv    $0,Color27
  204.     Cmv    $0,Color28
  205.     Cmv    $0,Color29
  206.     Cmv    $0,Color30
  207.     Cmv    $0,Color31
  208.     
  209. CopperBPLS    Cmv    $c,BplPt0h    
  210.     Cmv    $0,BplPt0l    
  211.     Cmv    $0,BplPt1h    
  212.     Cmv    $0,BplPt1l    
  213.     Cmv    $0,BplPt2h    
  214.     Cmv    $0,BplPt2l    
  215.     Cmv    $0,BplPt3h    
  216.     Cmv    $0,BplPt3l    
  217.     Cmv    $0,BplPt4h
  218.     Cmv    $0,BplPt4l 
  219.     
  220.     Cwt    $28    
  221.     Cmv    $1200,BplCon0    
  222.  
  223.     EndCop
  224.  
  225. TrackDisk    Incbin    MyMateMarmite/NuTrakkerFINAL-Seg
  226.  
  227. ****Custom Chip Registers****
  228.  
  229. Hardware    = $Dff000
  230.  
  231. ;Control Registers
  232.  
  233. Dmaconr    = $002
  234. Vposr    = $004
  235. Vhposr    = $006
  236. Joy0dat    = $00A
  237. Joy1dat    = $00C
  238. Clxdat    = $00E
  239. Intenar    = $01C
  240. Intereqr    = $01E
  241. Copcon    = $02E
  242.  
  243. ;Blitter Registers
  244.  
  245. Bltcon0    = $040
  246. Bltcon1    = $042
  247. Bltafwm    = $044
  248. Bltalwm    = $046
  249. Bltcpth    = $048
  250. Bltcptl    = $04A
  251. Bltbpth    = $04C
  252. Bltbptl    = $04E
  253. Bltapth    = $050
  254. Bltaptl    = $052
  255. Bltdpth    = $054
  256. Bltdptl    = $056
  257. Bltsize    = $058
  258. Bltcmod    = $060
  259. Bltbmod    = $062
  260. Bltamod    = $064
  261. Bltdmod    = $066
  262. Bltcdat    = $070
  263. Bltbdat    = $072
  264. Bltadat    = $074
  265.  
  266. ;Copper Registers
  267.  
  268. Cop1lc    = $080
  269. Cop1lch    = $080
  270. Cop1lcl    = $082
  271. Cop2lc    = $084
  272. Cop2lch    = $084
  273. Cop2lcl    = $086
  274. Copjmp1    = $088
  275. Copjmp2    = $08A
  276. Diwstrt    = $08E
  277. Diwstop    = $090
  278. Ddfstrt    = $092
  279. Ddfstop    = $094
  280. Dmacon    = $096
  281. Clxcon    = $098
  282. Intena    = $09A
  283. Intreq    = $09C
  284.  
  285. ;BitPlane Registers 
  286.  
  287. BplCon0    = $100
  288. BplCon1    = $102
  289. BplCon2    = $104
  290. BplMod1    = $108
  291. BplMod2    = $10a
  292.  
  293. BplPt0h    = $0e0
  294. BplPt0l    = $0e2
  295. BplPt1h    = $0e4
  296. BplPt1l    = $0e6
  297. BplPt2h    = $0e8
  298. BplPt2l    = $0ea
  299. BplPt3h    = $0ec
  300. BplPt3l    = $0ee
  301. BplPt4h    = $0f0
  302. BplPt4l    = $0f2
  303. BplPt5h    = $0f4
  304. BplPt5l    = $0f6
  305.  
  306. ;Colour Registers
  307.  
  308. Color00    = $180
  309. Color01    = $182
  310. Color02    = $184
  311. Color03    = $186
  312. Color04    = $188
  313. Color05    = $18a
  314. Color06    = $18c
  315. Color07    = $18e
  316. Color08    = $190
  317. Color09    = $192
  318. Color10    = $194
  319. Color11    = $196
  320. Color12    = $198
  321. Color13     = $19a
  322. Color14     = $19c
  323. Color15     = $19e
  324. Color16     = $1a0
  325. Color17     = $1a2
  326. Color18     = $1a4
  327. Color19     = $1a6
  328. Color20     = $1a8
  329. Color21     = $1aa
  330. Color22     = $1ac
  331. Color23     = $1ae
  332. Color24     = $1b0
  333. Color25     = $1b2
  334. Color26     = $1b4
  335. Color27     = $1b6
  336. Color28     = $1b8
  337. Color29     = $1ba
  338. Color30     = $1bc
  339. Color31     = $1be
  340.  
  341. EcsNop    = $1fe
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.